import {
    Toast
  } from "vant";
  import cTitle from "components/title";
  import {
    scrollMixin
  } from "../../../utils/mixin";
  export default {
    mixins: [scrollMixin], //加载更多
    data() {
      return {
        tabsList: [
            '直推用户',
            '团队用户'
        ],
        current: 0,//0直推 1团队用户
        countNum: 0,//总人数
        countNumValid: 0,//有效人数
        list: [],
        text: '',
        // page: 1,//分页 当前页数
        // pageCount: 1,//分页  总页数
        isLoadMore: true,
        page: 1,
        total_page: 0,
      };
    },
  
    components: {
      cTitle
    },
    // mounted() {
    //   if (!localStorage.getItem("uid")) {
    //     this.$router.push(this.fun.getUrl("member"));
    //     return
    //   }
    //   this.getList();
    // },
    activated() {
      console.log('active')
      // if (!localStorage.getItem("uid")) {
      //   this.$router.push(this.fun.getUrl("member"));
      //   return
      // }
      this.getList();
    },
    computed: {
  
    },
    methods: {
        changeTabs(index){
            this.current = index;
            this.getList();
        },
      openPicker() {
        this.pickerShow = true;
      },
      getList() {
        $http.get("HuanNiuJiuji.teamList", {
          uid: localStorage.getItem("uid"),
          type: this.current + 1
        }, "加载中").then((res) => {
          if (res.result == 1) {
            console.log(res, 'shuju_list')
            this.list = res.data.list;
            this.countNum = res.data.count;
            this.countNumValid = res.data.count_valid;
            // var nextPageData = res.data.data;
            // this.list = [...this.list, ...nextPageData];
            // this.total_page = res.data.last_page;
            // this.isLoadMore = true;
  
          } else {
            this.isLoadMore = false;
          }
        });
      },
      checkList() {
        this.page = 1;
        this.list = [];
        this.getList();
      },
      nameinput(e) {},
      //获取更多数据
      getMoreData() {
        // console.log("hongbao", this.isLoadMore);
        // if (!this.isLoadMore) return;
        // this.isLoadMore = false; // 防止多次请求分页数据
        // if (this.page >= this.total_page) {
        //   Toast('到底了')
        //   return;
        // } else {
        //   this.page += 1;
        //   this.getList();
        // }
      },
      partnerDetails(uid) {
        this.$router.push(this.fun.getUrl("yunTeamPerformance", {
          id: 2,
          uid: uid
        }));
      }
    }
  };